/* 重置默认样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
html {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.login-container {
  background: url('/1.svg') no-repeat center center;
  background-size: cover;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.login-form {
  padding: clamp(20px, 5vw, 40px);
  width: clamp(280px, 90vw, 450px);
  max-width: 90vw;
  transform: scale(1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-title {
  text-align: center;
  margin-bottom: clamp(20px, 5vw, 30px);
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: clamp(16px, 4vw, 24px);
  position: relative;
}

.form-input {
  width: 100%;
  padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 16px) clamp(12px, 3vw, 16px)
    clamp(45px, 4vw, 50px);
  border: 1px solid #e1e8ed;
  border-radius: clamp(8px, 2vw, 12px);
  font-size: clamp(14px, 3.5vw, 16px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: #2c3e50;
  backdrop-filter: blur(10px);
}

.form-input:focus {
  border-color: #4a90e2;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.form-input.error {
  border-color: #e74c3c;
  background: rgba(254, 242, 242, 0.8);
}

.form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* 输入框图标 */
.input-icon {
  position: absolute;
  left: clamp(12px, 3vw, 16px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(20px, 2.5vw, 24px);
  height: clamp(20px, 2.5vw, 24px);
  color: #94a3b8;
  z-index: 1;
}

/* 忘记密码链接 */
.forgot-password {
  text-align: right;
  margin-top: clamp(8px, 2vw, 12px);
  margin-bottom: clamp(16px, 4vw, 24px);
}

.forgot-password a {
  color: #94a3b8;
  text-decoration: none;
  font-size: clamp(12px, 2.5vw, 14px);
  transition: color 0.2s ease;
}

.forgot-password a:hover {
  color: #4a90e2;
}

/* 记住密码选项 */
.remember-password {
  display: flex;
  align-items: center;
  margin-bottom: clamp(20px, 5vw, 30px);
  gap: clamp(8px, 2vw, 12px);
}

.remember-password input[type='checkbox'] {
  width: clamp(16px, 2vw, 18px);
  height: clamp(16px, 2vw, 18px);
  accent-color: #4a90e2;
  cursor: pointer;
}

.remember-password label {
  color: #94a3b8;
  font-size: clamp(12px, 2.5vw, 14px);
  cursor: pointer;
  user-select: none;
}

.login-button {
  width: 100%;
  padding: clamp(14px, 3.5vw, 18px);
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  border: none;
  border-radius: clamp(10px, 2.5vw, 14px);
  font-size: clamp(15px, 3.5vw, 17px);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(74, 144, 226, 0.4);
}

.login-button:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  color: #e74c3c;
  font-size: clamp(11px, 2.5vw, 13px);
  margin-top: clamp(4px, 1vw, 6px);
  font-weight: 500;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-footer {
  margin-top: clamp(20px, 5vw, 30px);
  text-align: center;
  padding-top: clamp(16px, 4vw, 20px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-text {
  font-size: clamp(12px, 3vw, 14px);
  color: #000000;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.footer-link {
  color: #4a90e2;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #357abd;
  text-decoration: underline;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .login-container {
    padding: 0;
  }

  .login-form {
    margin: 20px;
    width: calc(100vw - 40px);
    max-width: none;
    border-radius: 16px;
  }

  .form-input {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .login-form {
    width: clamp(400px, 60vw, 500px);
    padding: clamp(30px, 4vw, 40px);
  }
}

/* 大屏幕优化 */
@media (min-width: 1025px) {
  .login-form {
    width: clamp(450px, 35vw, 550px);
    padding: 40px;
  }

  .login-title {
    font-size: 32px;
  }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
  .login-form {
    margin: 16px;
    width: calc(100vw - 32px);
    padding: 24px 20px;
  }

  .login-title {
    font-size: 18px;
    margin-bottom: 20px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .login-footer {
    margin-top: 16px;
    padding-top: 16px;
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
  .login-container {
    align-items: flex-start;
    padding-top: 20px;
  }

  .login-form {
    padding: clamp(16px, 3vw, 24px);
    margin: 0 20px;
  }

  .login-title {
    margin-bottom: clamp(12px, 3vw, 16px);
  }

  .form-group {
    margin-bottom: clamp(10px, 2.5vw, 14px);
  }

  .login-footer {
    margin-top: clamp(12px, 3vw, 16px);
    padding-top: clamp(12px, 3vw, 16px);
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .login-form {
    border: 0.5px solid rgba(255, 255, 255, 0.3);
  }

  .form-input {
    border-width: 1px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .login-container {
    background: url('/1.svg') no-repeat center center;
    background-size: cover;
  }

  .login-form {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .login-title {
    color: #f1f5f9;
  }

  .form-label {
    color: #cbd5e1;
  }

  .form-input {
    background: rgba(51, 65, 85, 0.8);
    border-color: #475569;
    color: #f1f5f9;
  }

  .form-input:focus {
    background: rgba(51, 65, 85, 1);
    border-color: #667eea;
  }

  .form-input.error {
    background: rgba(127, 29, 29, 0.8);
    border-color: #dc2626;
  }

  .form-input::placeholder {
    color: #64748b;
  }

  .footer-text {
    color: #94a3b8;
  }

  .footer-link {
    color: #93c5fd;
  }

  .footer-link:hover {
    color: #60a5fa;
  }
}

/* 模式切换器 */
.mode-switcher {
  display: flex;
  gap: clamp(8px, 2vw, 12px);
  margin-bottom: clamp(20px, 5vw, 30px);
  justify-content: center;
}

.mode-btn {
  padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 20px);
  border: 2px solid #e1e8ed;
  background: rgba(255, 255, 255, 0.8);
  color: #94a3b8;
  border-radius: clamp(6px, 1.5vw, 8px);
  font-size: clamp(12px, 2.5vw, 14px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.mode-btn:hover {
  border-color: #4a90e2;
  color: #4a90e2;
  background: rgba(255, 255, 255, 0.9);
}

.mode-btn.active {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
}

/* 人脸识别表单 */
.face-form {
  width: 100%;
}

.file-input {
  width: 100%;
  padding: clamp(12px, 3vw, 16px);
  border: 2px dashed #e1e8ed;
  border-radius: clamp(8px, 2vw, 12px);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: clamp(12px, 2.5vw, 14px);
  color: #94a3b8;
}

.file-input:hover {
  border-color: #4a90e2;
  background: rgba(255, 255, 255, 0.9);
  color: #4a90e2;
}

.file-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.file-input::file-selector-button {
  background: #4a90e2;
  color: white;
  border: none;
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2.5vw, 16px);
  border-radius: clamp(4px, 1vw, 6px);
  cursor: pointer;
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: 500;
  margin-right: clamp(8px, 2vw, 12px);
  transition: all 0.2s ease;
}

.file-input::file-selector-button:hover {
  background: #357abd;
  transform: translateY(-1px);
}

/* 图片预览 */
.image-preview {
  margin: clamp(16px, 4vw, 24px) 0;
  text-align: center;
}

.preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: clamp(8px, 2vw, 12px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.liveness-status {
  margin-top: clamp(8px, 2vw, 12px);
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2.5vw, 16px);
  background: rgba(74, 144, 226, 0.1);
  color: #4a90e2;
  border-radius: clamp(6px, 1.5vw, 8px);
  font-size: clamp(12px, 2.5vw, 14px);
  font-weight: 500;
}

/* 活体检测按钮 */
.liveness-btn {
  width: 100%;
  padding: clamp(12px, 3vw, 16px);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: clamp(8px, 2vw, 12px);
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.liveness-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.liveness-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 人脸操作区域 */
.face-actions {
  margin-top: clamp(20px, 5vw, 30px);
  padding-top: clamp(16px, 4vw, 20px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.face-buttons {
  display: flex;
  gap: clamp(12px, 3vw, 16px);
  margin-top: clamp(16px, 4vw, 24px);
}

.face-register-btn,
.face-login-btn {
  flex: 1;
  padding: clamp(12px, 3vw, 16px);
  border: none;
  border-radius: clamp(8px, 2vw, 12px);
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.face-register-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.face-register-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.face-login-btn {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.face-login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.face-register-btn:disabled,
.face-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 脉冲动画效果 */
@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
